#include <iostream>
using namespace std;

int parity_check(const unsigned char *msg, const int msg_length) {
    int parity = 0;
    for (int i = 0; i < msg_length; ++i) {
        if (msg[i] != 0) {
            parity =!parity;
        }
    }
    return parity;
}

int main() {
    system("chcp 65001");
    unsigned char test_msg[] = {1, 0, 1, 1, 0};
    int result = parity_check(test_msg, 5);
    if (result) {
        cout << "校验通过" << endl;
    } else {
        cout << "校验失败" << endl;
    }
    return 0;
}